<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>I_Only-Before&&After-nth伪类</title>
    <style>
        .demo:only-child{
            color:#fff;
            background: red;
            padding:10px;
        }
    </style>
</head>
<body>
    <div class="demo">
        慕课网
    </div>
</body>
</html>